/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2025-05-13     Administrator       the first version
 */
#ifndef HARDWARE_ROBOT_SELECTINIT_H_
#define HARDWARE_ROBOT_SELECTINIT_H_

#include "system.h"

//Parameter structure of robot
//机器人参数结构体
typedef struct
{
  float WheelSpacing;      //Wheelspacing, Mec_Car is half wheelspacing //轮距 麦轮车为半轮距
  float AxleSpacing;       //Axlespacing, Mec_Car is half axlespacing //轴距 麦轮车为半轴距
  int GearRatio;           //Motor_gear_ratio //电机减速比
  int EncoderAccuracy;     //Number_of_encoder_lines //编码器精度(编码器线数)
  float WheelDiameter;     //Diameter of driving wheel //主动轮直径
}Robot_Parament_InitTypeDef;

// Encoder structure
//编码器结构体
typedef struct
{
  int A; //左上
  int B; //左下
  int C; //右下
  int D; //右上
}Encoder;


//轮距 两个轮子水平轴的距离 麦轮是一半  40.0cm / 2 = 20
//#define MEC_wheelspacing         0.109
#define MEC_wheelspacing         0.200f
#define Four_Mortor_wheelSpacing 0.187f


//轴距 两个轮子竖直轴的距离 麦轮是一半  34.4cm / 2 = 17.2
#define MEC_axlespacing           0.172f
#define Four_Mortor__axlespacing  0.173f

//电机减速比
#define   GA25_370    21.3
#define   HALL_30F    30
#define   MD36N_5_18  5.18
#define   MD36N_27    27
#define   MD36N_51    51
#define   MD36N_71    71
#define   MD60N_18    18
#define   MD60N_47    47

//编码器精度
#define   Photoelectric_500 500
#define   Hall_13           13

//麦轮轮胎直径
#define     Mecanum_60  0.060f
#define     Mecanum_75  0.075f  //嵌赛的车是这个
#define     Mecanum_100 0.100f
#define     Mecanum_127 0.127f
#define     Mecanum_152 0.152f

//黑色轮胎（四驱车）
#define   Black_WheelDiameter   0.065

//编码器倍频数，取决于编码器初始化设置
#define   EncoderMultiples  4

//编码器数据读取频率，其实没有什么用
#define   CONTROL_FREQUENCY 100

#define PI                 3.14159265358979f

extern Robot_Parament_InitTypeDef  Robot_Parament;

void Robot_Select(void);
void Robot_Init(double wheelspacing, float axlespacing, float gearratio,float Accuracy,float tyre_diameter);




#endif /* HARDWARE_ROBOT_SELECTINIT_H_ */
